class Account(val id: Int, val initialBalance: Double) {
  private var balance = initialBalance
}

// 伴生对象
object Account {
  private var lastNumber = 0

  private def newUniqueNumber() = {lastNumber += 1; lastNumber}

  def apply(initialBalance: Double): Account = new Account(newUniqueNumber(), initialBalance)

  def main(args: Array[String]): Unit = {
    val account = Account(1000.0)  // 可以创建一个 Account 类
  }
}